<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue-2.6.12.js"></script>
  <script src="../js/vue-router.js"></script>
</head>
<body>
  <div id="app">
    <!-- <a href="#/login">登录</a>
    <a href="#/register">注册</a> -->
    <router-link to="/login">登录</router-link>
    <router-link to="/register">注册</router-link>
    <router-view></router-view>
  </div>
  <template id="login-form">
    <div>登录表单</div>
  </template>
  <template id="register-form">
    <div>注册表单</div>
  </template>
  <script>
    const loginForm = {
      template:"#login-form"
    }
    const registerForm = {
      template:"#register-form"
    }
    var router = new VueRouter({
      routes:[
        {name:"login",path:"/login",component:loginForm},
        {name:"register",path:"/register",component:registerForm},
        {name:"default",path:"/",redirect:"/login"},
      ]
    });
    new Vue({
      el:"#app",
      router:router
    });
  </script>
</body>
</html>